package TOYS.MRP;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import TOOLS.SQLtool;
import TOOLS.errCodeManagement;

public class test001_newDB {

	public static void main(String[] args) {
		SQLtool sql=new SQLtool();
		String IPaddr="192.168.1.1";
		try {
			InetAddress addr = InetAddress.getLocalHost();
			IPaddr=addr.getHostAddress();
		} catch (UnknownHostException e1) {
			;
		}
		sql.config(IPaddr, "AKS2019", "sa", "123456","newDB");
//		sql.config("10.130.0.231", "Smes", "sa", "led-00");
//		sql.config("192.168.0.39", "AKS2019", "sa", "abcd1234!");
		try {
			String timestamp=new String();
	    	SimpleDateFormat t = new SimpleDateFormat("yyyy-MM-dd");
	    	timestamp=""+t.format(new Date());
	    	System.out.println(timestamp);
	    	t = new SimpleDateFormat("YYYY-ww");
	    	timestamp=""+t.format(new Date());
	    	System.out.println(timestamp);
	    	Calendar cl = Calendar.getInstance();
	    	cl.setFirstDayOfWeek(Calendar.MONDAY);
	    	cl.setMinimalDaysInFirstWeek(1);
	    	int week = cl.get(Calendar.WEEK_OF_YEAR);
	    	int YY=cl.get(Calendar.YEAR);
	    	System.out.println(YY+"-"+week); 
//			sql.connect();
//			
//			
//			c_MRPbom c=new c_MRPbom(sql);
//			c.newDBsheet();
//			c.newDBview();
		} catch (Exception e) {
			String str=errCodeManagement.getErrText(e.getMessage());
			System.out.println(str);
		}
	}

}
